package br.edu.ifpr.GravityDodger;

import org.andengine.entity.IEntity;
import org.andengine.entity.modifier.DelayModifier;
import org.andengine.entity.modifier.IEntityModifier.IEntityModifierListener;
import org.andengine.entity.modifier.MoveXModifier;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.text.Text;
import org.andengine.util.modifier.IModifier;

import android.R;
import android.net.Uri;
import android.widget.VideoView;

public class SplashScene extends Scene {
	
	
   GravityDogerActivity activity;
   
   public SplashScene ()
   {
	   
	   LoadResources();
	   
	   VideoView videoView = new VideoView(activity);
	   videoView.setVideoURI(Uri.parse("android.resource://br.edu.ifpr.GravityDodger/"));
	   
	   
	   activity = GravityDogerActivity.getSharedInstance();
	   
	   Text title1 = new Text (0,0, activity.mFont, "oi?",
			   activity.getVertexBufferObjectManager());
	   
	   title1.setPosition(-title1.getWidth(), activity.mCamera.getHeight()/2);
	   
	   attachChild(title1);
	   title1.registerEntityModifier(new MoveXModifier(1, title1.getX(), activity.mCamera.getWidth()/2  - title1.getWidth()/2));
	 
   }
   
   public void LoadResources()
   {
	   DelayModifier dMod = new DelayModifier(2, new IEntityModifierListener() {

		public void onModifierFinished(IModifier<IEntity> arg0, IEntity arg1) {
			activity.setCurrentScene(new MainMenuScene());
			
		}

		public void onModifierStarted(IModifier<IEntity> arg0, IEntity arg1) {
			
		}
		});
		registerEntityModifier(dMod);
   }
}
